<template>
    <div class="qingwu">
        <div class="admin_table_page_title">缴费记录</div>
        <div class="unline underm"></div>

        <div class="admin_table_handle_btn">
            <a-form layout="inline" :form="form"  @submit="handleSubmit">
                <a-form-item label="订单号">
                    <a-input v-model="orderNo"  placeholder="请输入订单号" />
                </a-form-item>
                <a-form-item label="支付单号">
                    <a-input v-model="pay_no"   placeholder="请输入支付单号"/>
                </a-form-item>
                <a-form-item label="支付状态">
                    <a-select  @change="handleChange" style="width: 120px" v-model="status">
                        <a-select-option  value="" >
                            全部
                        </a-select-option>
                        <a-select-option  value="1" >
                            未支付
                        </a-select-option>
                        <a-select-option  value="2" >
                            已支付
                        </a-select-option>
                    </a-select>
                </a-form-item>
                <a-form-model-item >
                    <a-button icon="search" @click="search">
                        查询
                    </a-button>
                </a-form-model-item>
                <a-form-model-item >
                    <a-button  @click="reset">重置</a-button>
                </a-form-model-item>
            </a-form>
        </div>
        <div class="admin_table_list">
            <a-table :columns="columns" :data-source="list" :pagination="false" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" row-key="id">

                <div slot="userdata" slot-scope="rows">
                    <p>姓名: {{rows.community_owner ? rows.community_owner.username : ""}}</p>
                    <p>手机号: {{rows.community_owner ? rows.community_owner.mobile : ""}}</p>
                </div>

                <div slot="orderdata" slot-scope="rows">
                    <p>订单号: {{rows.orderNo}}
                    </p>
                    <p>支付号: {{rows.pay_no}}</p>
                </div>

                <div slot="facilitydata" slot-scope="rows">
                    <p>代理: <span> {{rows.platform_agent ? rows.platform_agent.agent_name : ""}}</span></p>
                    <p>手机: <span>{{rows.platform_agent ? rows.platform_agent.login_account : ""}}</span></p>
                </div>

                <div slot="balancedata" slot-scope="rows">
                    <p>缴费类型:
                        <span v-if="rows.type == 1" class="layui-badge layui-bg-blue">电费</span>
                        <span v-else-if="rows.type == 2" class="layui-badge layui-bg-blue">水费</span>
                        <span v-else-if="rows.type == 3" class="layui-badge layui-bg-orange">物业费</span></p>
                    <p>缴费方式:
                        <span v-if="rows.pay_type == 1" class="layui-badge layui-bg-blue">微信缴费</span>
                        <span v-else-if="rows.pay_type == 2" class="layui-badge layui-bg-blue">支付宝缴费</span>
                        <span v-else-if="rows.pay_type == 4" class="layui-badge layui-bg-orange">余额扣款</span></p>
                    <p>缴费途径: <span v-if="rows.is_instead == 1" class="layui-badge layui-bg-blue">自缴</span>
                        <span v-else-if="rows.is_instead == 2" class="layui-badge layui-bg-blue">代缴</span></p>
                </div>

                <div slot="pay" slot-scope="rows">
                    <p>支付金额:{{rows.paymentMoney}}</p>
                    <p>支付状态:
                        <span v-if="rows.status == 1" class="layui-badge layui-bg-blue">未支付</span>
                        <span v-else-if="rows.status == 2" class="layui-badge layui-bg-blue">已支付</span>
                    </p>
                </div>


                <div slot="time" slot-scope="rows">
                    <p>创建时间:{{rows.create_time}}</p>
                    <p>支付时间:{{rows.paymentTime}}</p>
                </div>

                <div slot="fashionable" slot-scope="rows">
                    <p>是否分账:
                        <span v-if="rows.is_split == 1" > 是</span>
                        <span v-else-if="rows.is_split == 2" >否</span>
                    </p>
                    <p>分账金额:{{rows.split_money}}</p>
                    <p>提现手续费:{{rows.handlingFee}}</p>
                    <p>分账完成后金额:{{rows.after_split}}</p>
                    <p>去掉手续费金额:{{rows.after_handling}}</p>
                </div>
            </a-table>
            <div class="admin_pagination" v-if="total>0">
                <a-pagination v-model="params.page" :page-size.sync="params.per_page" :total="total" @change="onChange" show-less-items />
            </div>
        </div>
    </div>
</template>

<script>
export default {
    components: {},
    props: {},
    data() {
      return {
          params:{
              page:1,
              per_page:30,
          },
          total:0, //总页数
          selectedRowKeys:[], // 被选择的行
          columns:[
              {title:'序号',dataIndex:'id',fixed:'left'},
              {title:'订单信息',scopedSlots: { customRender: 'orderdata' }},
              {title:'用户信息',scopedSlots: { customRender: 'userdata' }},
              {title:'代理商信息',scopedSlots: { customRender: 'facilitydata' }},
              {title:'缴费信息',scopedSlots: { customRender: 'balancedata' }},
              {title:'支付金额', scopedSlots: { customRender: 'pay' }},
              {title:'缴费时间',scopedSlots: { customRender: 'time' }},
              {title:'分账信息',scopedSlots: { customRender: 'fashionable' }},
          ],
          list:[],
          community_lists: [],
          status:''
      };
    },
    watch: {},
    computed: {},
    methods: {
        // 选择框被点击
        onSelectChange(selectedRowKeys) {
            this.selectedRowKeys = selectedRowKeys;
        },
        // 选择分页
        onChange(e){
            this.params.page = e;
            this.onload();
        },
        // 支付状态
        handleChange(value, selectedOptions){
            this.status = value;
        },
        onload(){
            this.$get(this.$api.estatePaymentOrder,this.params).then(res=>{
                this.total = res.data.total;
                this.list = res.data.data;
            });
        },
        // 重置
        reset(){
            location.reload();
        },
        // 搜索
        search(){
            this.params['orderNo'] = this.orderNo;
            this.params['pay_no'] = this.pay_no;
            this.params['status'] = this.status;
            this.$get(this.$api.estatePaymentOrder,this.params).then(res=>{
                this.total = res.data.total;
                this.list = res.data.data;
            });
        },
    },
    created() {
        this.onload();
        // this.getCommunityList();/**/
    },
    mounted() {}
};
</script>
<style lang="scss" scoped>

</style>
